<template>
  <q-page padding>
    <div class="text-subtitle1 text-center">
      {{ news.title }}
    </div>
    <q-img
      :src="newsImgBase + '/' + news.img"
      spinner-color="red"
    />
    <q-btn class="float-left q-mt-md q-ml-sm q-mb-md" @click="JumpOut(news.url)" color="primary" icon="mail" label="查看原文" />
<div class="q-ma-md">
</div>
  </q-page>
</template>

<script>
export default {
  name: 'NewsDetail',
  data () {
    return {
      news: {
        pk: null,
        title: 'test',
        img: '-1848236193252188445.png',
        url: 'http://baidu.com'
      }
    }
  },
  async mounted () {
    await this.fetchData()
  },
  methods: {
    JumpOut (url) {
      window.open(url, '_blank')
    },
    async fetchData () {
      await this.$store.dispatch('comp/getNewsDetail', this.$route.params.id)
        .then(news => {
          this.news = news
        })
    }
  }
}
</script>
